package de.fuberlin.inf.alp3.utils;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.List;
import java.util.Vector;

public class TestData {
    public static List<String> getCountries(boolean randomOrder) {
        List<String> countries = new Vector<String>(200);
        
        try {
            BufferedReader in = new BufferedReader(new InputStreamReader(TestData.class.getResourceAsStream("countries.txt")));
            String l;
            while ((l = in.readLine()) != null)
                countries.add(l);
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (randomOrder) {
            List<String> random = new Vector<String>();
            while (!countries.isEmpty())
                random.add(countries.remove((int) Math.round((countries.size() - 1) * Math.random())));
            return random;
        }

        return countries;
    }
}
